package demo;

/**
 *    爬楼梯
 */
class Solution34 {
	public int climbStairs(int n) {
		if (n < 3) {
			return n;
		}
		int i1 = 1;
		int i2 = 2;
		for (int i = 3; i <= n; i++) {
			int tmp = i1 + i2;
			i1 = i2;
			i2 = tmp;
		}
		return i2;
	}
}

